<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<TcaKnowledgefile> list = (List<TcaKnowledgefile>)request.getAttribute("list");
	List<TcaKnowledgefolder> folderList = (List<TcaKnowledgefolder>)request.getAttribute("folderList");
	WikiForm form = (WikiForm)request.getAttribute("command");
	String title = StringUtils.isNotBlank(form.getTitle())?form.getTitle():"";
	String folderId = StringUtils.isNotBlank(form.getFolderId())?form.getFolderId():"-1";
%>

<div class="userListWrap">

     <form id="userListForm">
        <div class="form-item">
    		<label for="deviceid">标题:</label>
    		<input class="easyui-validatebox" type="text" name="title" data-options="" value="<%=title%>"/>
        </div>
        <div class="form-item">
    		<label for="deviceid">所属分类:</label>
    		<select name="folderId">
    			<option value="-1">全部</option>
				<%
					for(TcaKnowledgefolder folder:folderList){
						%>
							<option value="<%=folder.getFolderid()%>" <%=folderId.equalsIgnoreCase(folder.getFolderid())?"selected=selected":""%>><%=folder.getTitle()%></option>
						<%
					}
				%>
			</select>
        </div>
        <div class="form-item form-item">
    		<a href="javascript:XF.WIKI.item_manage_search()" class="input-btn-microsoft input-btn-microsoft-24">搜索</a>
        </div>
    </form>

    <table id="barListTable" class="easyui-datagrid"  title="" >
        <thead>
    		<tr>
    			<th data-options="field:'deviceid',width:300" orderByField='deviceid' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('deviceid')" >标题</a>
				</th>
    			<th data-options="field:'siteid',width:120" orderByField='siteid' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('siteid')" >所属分类</a>
				</th>
    			<th data-options="field:'companyName',width:150" orderByField='companyName' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('companyName')" >添加时间</a>
				</th>
 				<th data-options="field:'addTime',width:140" orderByField='addTime' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('addTime')" >添加人</a>
				</th>
				<th data-options="field:'valid',width:50" orderByField='valid' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('valid')" >状态</a>
				</th>
				<th data-options="field:'opr',width:100">操作</th>
    		</tr>
        </thead>
        <tbody>
		   	<%
	          	if(null!=list && list.size()>0){
	          		for(TcaKnowledgefile item:list){
	          			String id = EncrypTool.encode(item.getSeqid()+"");
	          			String valid = StringUtils.isNotBlank(item.getValid())?item.getValid():"0";
	          			if("1".equalsIgnoreCase(valid)){
	          				valid = "<span style='color:#2d78f4'>已通过</span>";
	          			}else if("-1".equalsIgnoreCase(valid)){
	          				valid = "<span style='color:#c00'>未通过</span>";
	          			}else{
	          				valid = "待审核";
	          			}
	          			%>
						<tr>
							<td><i s="<%=EncrypTool.encode(item.getSeqid()+"")%>"></i><%=StringUtils.isNotBlank(item.getTitle())?item.getTitle():""%></td>
							<td><%=StringUtils.isNotBlank(item.getFolderTitle())?item.getFolderTitle():""%></td>
							<td><%=null!=item.getAddtime()?DateFormatUtils.format(item.getAddtime(), "yyyy-MM-dd HH:mm:ss"):"" %></td>
							<td><%=StringUtils.isNotBlank(item.getAdduser())?item.getAdduser():""%></td> 
							<td><%=valid%></td> 
							<td>
								<a href="javascript:XF.WIKI.item_edit('<%=id%>')"><span>修改</span></a>
								<a href="javascript:XF.WIKI.item_delete('<%=id%>')"><span>删除</span></a>
	    					</td>
						</tr>
						<%
	           		}
	           	}
	        %>
    	</tbody>
    </table>
    <div class="pagination paginationFixWidth">
		<monggoTag:pagination 
		href="wiki_search_manage"
		pageSize="<%=form.getPageSize()%>" 
		totalRecord="<%=form.getTotalRecord() %>" 
		currentPage="<%=form.getPageNum() %>">
		</monggoTag:pagination> 
	</div>
</div>
<script>
	$('#barListTable').datagrid();  
</script>





























